<template>
  <div id="detail-comment">
    <div class="title">
      <span>用户评价</span>
      <span>更多</span>
    </div>
    <div>
      <div
        class="comment-item"
        v-for="(item, index) in detail_comment"
        :key="index"
      >
        <div class="user">
          <img class="avatar" :src="item.user.avatar" alt="" />
          <span class="name">{{ item.user.uname }}</span>
        </div>
        <div class="comment-text">{{ item.content }}</div>
        <div class="other">
          <span class="time-info">{{ item.created | timeFilter }}</span>
          <span class="style-info">{{ item.style }}</span>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    detail_comment: {
      type: Array,
      default() {
        return []
      },
    },
  },
  filters: {
    timeFilter(val) {
      return new Date(val*1000).toLocaleString()
    },
  },
  created() {},
  methods: {
    // imgLoad() {
    //   if (!this.lockEmit) {
    //     this.$emit('img-load-finished')
    //     this.lockEmit = true
    //   }
    // },
  },
}
</script>

<style lang="less" scoped>
#detail-comment {
  padding: 0 15px;
  border-bottom: 5px solid #eeeeee;
  .title {
    height: 45px;
    line-height: 45px;
    display: flex;
    justify-content: space-between;
    border-bottom: 1px solid #eeeeee;
  }

  .comment-item {
    .user {
      display: flex;
      flex-direction: row;
      align-items: center;
      padding: 10px 0;

      .avatar {
        width: 50px;
        border-radius: 50%;
      }

      .name {
        margin-left: 10px;
      }
    }

    .comment-text {
      color: #666666;
    }

    .other {
      height: 35px;
      line-height: 35px;
      font-size: 12px;
      color: #999999;
      .time-info {
      }

      .style-info {
        margin-left: 10px;
      }
    }
  }
}
</style>
